'use strict';

/**
 * sessionKey - service
 */

const { Service } = require('egg');

class SessionService extends Service {
  get model() {
    return this.ctx.model.SessionKey;
  }

  async create(obj) {
    const Model = new this.model(obj);
    return await Model.save();
  }

  async find(obj) {
    return await this.model.find(obj);
  }

  async update(cond, obj) {
    return await this.model.update(cond, { $set: obj });
  }
}

module.exports = SessionService;
